<%--
  Created by IntelliJ IDEA.
  User: Acer
  Date: 2020/9/18
  Time: 8:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<rapid:override name="head" >
    <title>课程详情页</title>
</rapid:override>

<rapid:override name="content">


    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>


    <div class="layui-form" style="width: 400px;margin: 0 auto">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col width="150">
                <col>
            </colgroup>
            <tbody>
            <tr>

                <td>课程编号</td>
                <td>${course.classId}</td>
            </tr>
            <tr>
                <td>课程名称</td>
                <td>${course.className}</td>
            </tr>
            <tr>
                <td>教师名称</td>
                <td>${course.teaName}</td>
            </tr>
            <tr>
                <td>人数限制</td>
                <td>${course.classNum}</td>
            </tr>
            <tr>
                <td>已选人数</td>
                <td>${course.classChooseNum}</td>
            </tr>
            <tr>
                <td>学院限制</td>
                <td>

                    <c:forEach items="${course.classLimitInsName}" var="ins">
                        ${ins}
                    </c:forEach>

                </td>
            </tr>
            </tbody>
        </table>
        <div class="layui-input-block">
            <button type="button" class="layui-btn layui-btn-lg"  onclick="javascript:history.back(-1)">上一页</button>
            <button type="button" id="success" class="layui-btn layui-btn-danger layui-btn-lg" onclick="choose(${course.classId})">选择</button>
        </div>
    </div>

    <script>
        function choose(classId) {
            let r = confirm("你确定要选择这门课程吗？");
            if(r) {
                window.location.href="<%=basePath%>student/chooseCourse?classId="+classId;
            } else {
                return;
            }


        }
    </script>
</rapid:override>

<%@include file="base.jsp"%>